Remainder (num, denom)

Basic and Crystal syntax.

Arguments
Returns

Fractional Value

Action

Remainder returns the remainder after the numerator (dividend) has been divided by the denominator (divisor). In a typical division situation, the program expresses a quotient as a whole number (if any) and up to six decimal places. When using Remainder, however, the program performs the division internally, determines the whole number quotient and the remainder, and returns only the remainder.

Typical uses

You can use this function in making conversions (feet to miles, units to grosses, etc.) You can also use it to select every nth item out of an array.

Examples

The following examples are applicable to Basic and Crystal syntax:

Remainder(12,5)

Returns 2.

Remainder(16,5)

Returns 1.

Rem Basic syntax

If Remainder ({file.EXAM#}, 7) = 0 Then

    formula = "*****"

End If


//Crystal syntax

If Remainder({file.EXAM#}, 7) = 0 Then

    "*****"

Else

    ""

This flags every 7th exam for grading by a second party.

ToText(Truncate({file.DAYS}/7)) + " week(s), " + ToText(Remainder({file.DAYS},7)) + " day(s)"

Returns "9 week(s), 1 day(s)". Converts days to weeks and days. For example, if the field had a value of 64 days, the formula would return the value of "9 week(s), 1 day(s)."

Related topics

Modulus (x Mod y)

Formula 13

Formula 17



Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com